<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 普通字符串
    // let name = 'Jack'
    // let msg = "Hello World"

    // 模版字符串
    // let name = `Jack`
    // let msg = `Hello World`

    // 好处：

    // let htmlStr = '<div class="hot-goods-box"><h1>热门商品</h1><p>卖爆了卖爆了卖爆了</p></div>'

    let htmlStr = `<div class="hot-goods-box">
      <h1>热门商品</h1>
      <p>卖爆了卖爆了卖爆了</p>
    </div>`

    let name = 'Bit'
    let age = 9
    // let str = 'My name is xxx, I am xxx years old, I am 已成年 or 未成年'
    // let str = 'My name is ' + name + ', I am ' + age + ' years old, I am ' + (age >= 18 ? '已成年' : '未成年')

    let str = `My name is ${name}, I am ${age} years old, I am ${age >= 18 ? '已成年' : '未成年'}`

    console.log(str)
  </script>
</body>

</html>